﻿namespace Cspl.Project.Console
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public delegate int MyDelegate(int a, int b, int c);

    class Program
    {
        struct Point
        {
            public int X { get; set; }
            public int Y { get; set; }
        }

        static void Main(string[] args)
        {
            IList<Student> students = new List<Student>();
            students.Add(new Student 
                {
                    Id = "12345",
                    Name = "SiX",
                    Faculty = "Electrical Engineering",
                    Major = "Electro"
                });
            students.Add(new Student
            {
                Id = "12346",
                Name = "SiY",
                Faculty = "Electrical Engineering",
                Major = "Power"
            });
            students.Add(new Student
            {
                Id = "12347",
                Name = "SiA",
                Faculty = "Informatics Engineering",
                Major = "Information System"
            });

            int count = students.Count(s => s.Faculty.Equals("Electrical Engineering"));
            Console.WriteLine("count : " + count);

            //IList<Point> points = new List<Point>();
            //points.Add(new Point { X = 1, Y = 2 });
            //points.Add(new Point { X = 1, Y = 3 });
            //points.Add(new Point { X = 1, Y = 4 });
            //points.Add(new Point { X = 2, Y = 2 });
            //points.Add(new Point { X = 2, Y = 3 });

            //var pointsX1 = points.Where(p => p.X==1 && p.Y==4);

            //foreach (Point p in pointsX1)
            //{
            //    Console.WriteLine("({0},{1})", p.X, p.Y);
            //}

            //ClassA classA = new ClassA(95);
            //classA.ShowTheProperty();

            //ClassC classC = new ClassC();
            //classC.PublicMethod();
            //classC.ChildMethod();

            //ClassC classC = new ClassC();
            //classC.ExecuteDelegate(new MyDelegate(AddNumbers));

            //int[] numbers = new int[7] { 0, 1, 2, 3, 4, 5, 6 };

            //var evenNumbers = numbers.Where(num => isEvenNumber(num));

            //var numCount =
            //    (from num in numbers
            //    where num > 2
            //    select num).Average();
            //Console.WriteLine("numCount : " + numCount);

            //IList<int> evenNumbers = new List<int>();

            //foreach (int num in numbers)
            //{
            //    if (num % 2 == 0)
            //    {
            //        evenNumbers.Add(num);
            //    }
            //}

            //var evenNumbers =
            //    from num in numbers
            //    where (num % 2) == 0
            //    select num;

            //foreach (int num in evenNumbers)
            //{
            //    Console.Write(num + " ");
            //}

            Console.ReadKey();
        }

        //public static int AddNumbers(int a, int b, int c)
        //{
        //    return a + b + c;
        //}

        static bool isEvenNumber(int num)
        {
            return num % 2 == 0;
        }

    }
}
